package com.example.websocketdemo.Socket;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Scanner;


/**
 * @program: basic
 * @description:
 * @author: Cloud
 * @create: 2020/11/17 10:22:41
 */
@RestController
@RequestMapping("/websocket")
public class IndexController {

    @Autowired
    private SocketClient client;

    @GetMapping("sendMessage1")
    public void sendMessage1(){
        Scanner scn = new Scanner(System.in);
        System.out.println("开始进行会话~");
        while (scn.hasNextLine()){
            String message = scn.nextLine()+" ";
            client.groupSending(message);
        }
    }
}
